<template>
  <div>
    <el-container>
       <el-header id="header" style="height:70px">
           <h1>WebBLog</h1>
           <span>
             欢迎回来！{{User.userName}}
             <button @click="logout">退出登录</button>
             
           </span>
           
       </el-header>
      <el-container>
        <vaside class="vaside" :User="User"></vaside>
        <el-container style="min-height:650px">
          <el-main>
            <router-view></router-view>
          </el-main>
        </el-container>
      </el-container>
      <el-footer id="footer">
        <span>WebBlog个人博客 作者：杨富鹏</span>
      </el-footer>
    </el-container>
  </div>
</template>

<script>
import vaside from "./Aside.vue";
export default {
  name: "Manage",
  data() {
    return {
      User: {},
    };
  },
  methods:{
    logout(){
      localStorage.removeItem("access-User");
      localStorage.removeItem("access-Token");
      this.$router.push('./login');
    }
  },
  components: {
    vaside,
  },
  created() {
    this.User = JSON.parse(localStorage.getItem("access-User"));
  },
};
</script>

<style >
*{
  margin: 0;
  padding: 0;
}
#header,#footer{
	background-color: lightgray;
}


#header h1{
  float: left;
  line-height: 70px;
}
#header span{
  float: right;
  line-height: 70px;
}
#header button{
  margin:0px 20px 0px 10px;
  border: none;
  background-color: inherit;
  cursor: pointer;
}
#header button:hover{
  text-decoration: underline;
  color:rgba(226, 60, 0, 0.932);
}

#footer{
  text-align: center;
  height:70px;
}
#footer span{
  line-height: 70px;
  font-size: 15px;
  color: gray;
}
</style>
